<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="dragon.core.exception.ExceptionHandler"%>
<%@ page import="dragon.core.exception.EasyUIDataLoadException"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.HashMap"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.io.IOException"%>
<%@ page import="org.json.simple.JSONObject"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";

	Exception e = (Exception) request.getAttribute("ejwException");

	String cause = e.getCause().getClass().getName();

	if ("dragon.core.exception.EasyUIDataLoadException".equals(cause)) {
		/**dragon.core.exception.EasyUIDataLoadException*/

		Map<String, Object> jsonMap = new HashMap<String, Object>();
		jsonMap.put("total", 0);
		jsonMap.put("rows", new ArrayList());
		jsonMap.put("errors", EasyUIDataLoadException.paraseException(e));
		JSONObject jsonObject = new JSONObject();
		jsonObject.putAll(jsonMap);

		response.setCharacterEncoding("UTF-8");
		try {
			response.getWriter().write(jsonObject.toJSONString());
		} catch (IOException e2) {
			throw new Exception(e2);
		}
%>



<%
	} else {
		/**dragon.core.exception.ExceptionHandler*/
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<base href="<%=basePath%>" />
<title>程序执行发生异常</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body>
	程序执行异常：
	<%
	String errors = ExceptionHandler.paraseException(e);
%>
	<hr>
	<%=errors.replace("\n", "<br>")%>
	<hr>
	<input type="button" onclick="javascript:window.history.go(-1);" value="返回">
</body>
<script type="text/javascript">
	
</script>
</html>
<%
	}
%>


